//
// Created by Bruce on 11/21/24.
//

#ifndef CAMMULTITHREADDETECTOR_CAMMULTITHREADDETECTORCONTROLLER_HPP
#define CAMMULTITHREADDETECTOR_CAMMULTITHREADDETECTORCONTROLLER_HPP

#pragma once

#include "include/Adapter/cammultithreaddetector_imagegrabber.h"
#include "include/Application/cammultithreaddetector_algofunctioner.h"
#include "include/Application/cammultithreaddetector_formatconverter.h"

namespace CamMultiThreadDetector{

	namespace Controller{

		struct CameraFunctioners
		{
			Adapter::ImageGrabber m_ImageGrabber;
			Application::FormatConverter m_FormatConverter;
			Application::AlgoFunctioner m_AlgoFunctioner;
		};

		class CamMultiThreadDetectorController
		{
		public:
			CamMultiThreadDetectorController();
			virtual ~CamMultiThreadDetectorController();
			static std::shared_ptr<CamMultiThreadDetectorController> getInstance();
			virtual int  getCameraAmount(int& __outAmount);
			virtual void cameraStartGrab();
			virtual void cameraStopGrab();
			virtual void run();

		private:
			virtual void init();
			virtual void unInit();
			virtual int  setParams();
			virtual int  getCameraInstance();
			virtual void initCameraInstance();

		private:
			Adapter::ImageGrabber        *m_ImageGrabber0    = NULL;
			Application::FormatConverter *m_FormatConverter0 = NULL;
			Application::AlgoFunctioner  *m_AlgoFunctioner0  = NULL;
			Adapter::ImageGrabber        *m_ImageGrabber1    = NULL;
			Application::FormatConverter *m_FormatConverter1 = NULL;
			Application::AlgoFunctioner  *m_AlgoFunctioner1  = NULL;

			Pylon::CInstantCameraArray   *m_cameraArray      = NULL;

		}; // class CamMultiThreadDetectorController

	} // namespace Controller

} // namespace CamMultiThreadDetector

#endif // CAMMULTITHREADDETECTOR_CAMMULTITHREADDETECTORCONTROLLER_HPP
